package com.example.blogother.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xpd.blog.bean.Article;
import com.xpd.blog.bean.Fail;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xpd
 * @since 2024-10-30
 */
public interface FailMapper extends BaseMapper<Fail> {
    @Results(id="rm1",value = {
            @Result(column = "id",property = "id",id=true),
            @Result(column = "aid",property = "aid"),
            @Result(column = "aid",property = "article" ,one=@One(
                    select = "selectByAidArticle"
            ))
    })
    @Select("select * from fail where usid=#{usid} limit #{page}, #{size}")
    List<Fail> selectByUsid(@Param("usid") int usid,@Param("page") int page,@Param("size")int size);
    @Select("select * from article where aid=#{aid}")
    Article selectByAidArticle(int aid);
}
